package com.mofang.ticketing.user.serve.account.dto.response;

import com.mofang.ticketing.common.core.enums.IBaseEnum;
import com.mofang.ticketing.common.core.enums.account.AccountTypeEnum;
import com.mofang.ticketing.common.core.enums.base.SysEnableEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author LGC
 * @date 2022/5/13 17:17
 */
@Data
@ApiModel(value = "账号分页列表")
public class PlatformAccountListPageRespDTO implements Serializable {

    private static final long serialVersionUID = -2587750286636653258L;

    @ApiModelProperty(value = "用户ID")
    private Long id;

    @ApiModelProperty(value = "所属组织 1=平台、2=商户、3=项目成员")
    private Integer belong;


    @ApiModelProperty(value = "账号类型 1=平台管理员、2=商户管理员、3=商户成员、4=项目成员")
    private Integer accountType;

    @ApiModelProperty(value = "账号类型 1=平台管理员、2=商户管理员、3=商户成员、4=项目成员")
    private String accountTypeStr;

    @ApiModelProperty(value = "姓名")
    private String username;

    @ApiModelProperty(value = "账号/手机号")
    private String account;

    @ApiModelProperty(value = "启用状态 1=启用 0=禁用")
    private Integer isEnable;

    @ApiModelProperty(value = "启用状态 1=启用 0=禁用")
    private String isEnableStr;

    @ApiModelProperty(value = "0=普通、1=系统管理员")
    private Integer isAdmin;

    @ApiModelProperty(value = "角色id")
    private Long roleId;

    @ApiModelProperty(value = "角色名称")
    private String roleName;

    @ApiModelProperty(value = "角色code")
    private String roleCode;

    @ApiModelProperty(value = "商户ID")
    private Long merchantId;

    @ApiModelProperty(value = "商户名称")
    private String merchantName;

    @ApiModelProperty(value = "项目ID")
    private Long projectId;

    @ApiModelProperty(value = "项目名称")
    private String projectName;

    public String getAccountTypeStr() {
        if (accountType != null) {
            return IBaseEnum.getValueByKey(accountType, AccountTypeEnum.class);
        }
        return accountTypeStr;
    }

    public String getIsEnableStr() {
        if (isEnable != null) {
            return SysEnableEnum.getValueByKey(isEnable);
        }
        return isEnableStr;
    }
}
